""""
用户个人中心page
"""
from time import sleep
from selenium.webdriver.common.by import By
from selenium import webdriver
from page.base_page import BasePage
class UserInformation(BasePage):
    # def __init__(self,driver):
    #     self.driver=driver
    #定位器
    user_email_locator=(By.XPATH,"/html/body/div[8]/div[2]/div/div/div/form[1]/table/tbody/tr[3]/td[2]/input")
    user_msn_locator=(By.CSS_SELECTOR,"body > div.block.clearfix > div.AreaR > div > div > div > form:nth-child(4) > table > tbody > tr:nth-child(4) > td:nth-child(2) > input")
    user_qq_locator=(By.CSS_SELECTOR,"body > div.block.clearfix > div.AreaR > div > div > div > form:nth-child(4) > table > tbody > tr:nth-child(5) > td:nth-child(2)")
    user_ot_locator=(By.CSS_SELECTOR,"body > div.block.clearfix > div.AreaR > div > div > div > form:nth-child(4) > table > tbody > tr:nth-child(6) > td:nth-child(2) > input")
    user_hp=locator=(By.CSS_SELECTOR,"body > div.block.clearfix > div.AreaR > div > div > div > form:nth-child(4) > table > tbody > tr:nth-child(7) > td:nth-child(2) > input")
    user_tlephone_locator=(By.CSS_SELECTOR,"body > div.block.clearfix > div.AreaR > div > div > div > form:nth-child(4) > table > tbody > tr:nth-child(8) > td:nth-child(2) > input")
    paswd_answer_locator=(By.CSS_SELECTOR,"body > div.block.clearfix > div.AreaR > div > div > div > form:nth-child(4) > table > tbody > tr:nth-child(10) > td:nth-child(2) > input")
    submit_locator=(By.XPATH,"/html/body/div[8]/div[2]/div/div/div/form[1]/table/tbody/tr[4]/td/input[2]")
    old_password_locator=(By.NAME,"old_password")
    new_password_locator = (By.NAME, "new_password")
    comfirm_password_locator=(By.NAME, "comfirm_password")
    submit_password_locator=(By.CSS_SELECTOR,"body > div.block.clearfix > div.AreaR > div > div > div > form:nth-child(5) > table > tbody > tr:nth-child(4) > td > input.bnt_blue_1")
    #操作方法
    def useremail(self):
        self.driver.find_element(*self.user_email_locator).click()
        sleep(2)
        self.driver.find_element(*self.user_email_locator).clear()
        sleep(2)
        self.driver.find_element(*self.user_email_locator).send_keys("319406770@qq.com")
    #断言使用邮件输入框内容的实际结果
    def useremailvalue(self):
        a = self.driver.find_element(*self.user_email_locator).get_attribute("value")
        return a
    def submit(self):
        self.driver.find_element(*self.submit_locator).click()


    def oldpassword(self):
        self.driver.find_element(*self.old_password_locator).send_keys("123456")
    def newpassword(self):
        self.driver.find_element(*self.new_password_locator).send_keys("1234567")
    def comfirmpassword(self):
        self.driver.find_element(*self.comfirm_password_locator).send_keys("1234567")
    def submitpassword(self):
        self.driver.find_element(*self.submit_password_locator).click()